<?php
/**
 * CreateTime: 2024/1/15 14:49
 * User:LinQ
 */

namespace App\ApiCall\Wx\Applet;

use App\ApiCall\ApiCallBasicAbstract;
use Illuminate\Support\Facades\Http;

class WxAppletClient extends ApiCallBasicAbstract
{

    public static function getInstance($appId, $appKey, $url)
    {
        if(!self::$instance){
            self::$instance = new WxAppletClient($appId, $appKey, $url);
        }
        return self::$instance;
    }

    function execute($path, $data)
    {
        if($this->requestType == 'GET'){
            return  Http::withHeaders($this->header)->get($this->url.$path,$data);
        }
        return Http::withHeaders($this->header)->post($this->url.$path,$data);
    }
}